iT邦幫忙

0

python3-日曆

  • 分享至 

  • xImage
  •  

在python3中,想要製作日曆有兩種方式,先介紹第一種:
-直接使用python中calendar模組

import calendar
calendar.setfirstweekday(firstweekday=6) 
#setfirstweekday =>設定每星期的第一天
#firstweekday=6 =>要設定星期幾是每星期的第一天(0=星期一,6=星期日)
print(calendar.calendar(2021, w=1, l=1, c=5))
#.calendar(年度, w=顯示日期的寬度(), l=每星期占用的行數, c=月和月的間隔寬度,, m=設定幾個月為一列的年曆(預設三個一列,設定為4表示四個月一列))

https://ithelp.ithome.com.tw/upload/images/20210808/201346174S4PwVRuAX.png

print(calendar.calendar(2021, w=3, l=3, c=6, m=4))

https://ithelp.ithome.com.tw/upload/images/20210808/20134617VldInR0oJ2.png


圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言